<template>
  <div class="input">
    <input
      @keydown.enter="add"
      v-model="values"
      type="text"
      placeholder="代办事项"
      name=""
      id=""
    />
    <button id="bag4" @click="add">提交</button>
  </div>
</template>

<script>
import { reactive, ref, toRefs } from "vue";
import { useStore } from "vuex";
export default {
  setup(props) {
    let obj = reactive({});
    let store = useStore();
    let values = ref("");
    function add() {
      store.commit("add", values.value);
    }
    return {
      add,
      ...toRefs(obj),
      values,
    };
  },
  components: {},
};
</script>

<style lang="scss" scoped>
.input {
  width: 100%;
  height: 95px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  input {
    width: 70%;
    height: 43%;
    border: 0;
    outline: none;
    border: 1px solid #a9b9cd;
    border-radius: 4px;
    padding-left: 10px;
  }
  button {
    height: 46%;
    width: 20%;
    border-radius: 4px;
    border: 0;
    background-color: #f49995;
    color: #fff;
  }
}
</style>
